﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SimpleFactoryPattern.MyChartFactory
{
    class ChartFactory
    {
        public static Chart GetChart(string type) 
        {
            Chart chart = null;
            switch (type)
            {
                case "Histogram":
                    {
                        chart = new HistogramChart();
                        Console.WriteLine("初始化设置柱状图！");
                    }
                    break;
                case "Pie":
                    {
                        chart = new PieChart();
                        Console.WriteLine("初始化设置饼状图！");
                    }
                    break;
                case "Line":
                    {
                        chart = new LineChart();
                        Console.WriteLine("初始化设置折线图！");
                    }
                    break;
            }
            return chart;
        }
    }
}
